import axios from '@/libs/axios'
import apiUrl from '../base'

const ProjectTeam = {
  findList(data) {
    return axios.post(`${apiUrl.base}v1/OrgTree/list`, data)
  },
  findCode(type, id, area) {
    let types
    if (area == 'org') {
      types = 2
    } else if (area == 'work') {
      types = 3
    } else {
      if (type == 2 || type == 6) {
        types = 6
      } else if (type == 3 || type == 7) {
        types = 7
      }
    }
    const data = {}
    return axios.post(
      `${apiUrl.base}v1/OrgTree/tree/codeGenerate/${types}/${id}`,
      data
    )
  },
  getDetail(id) {
    return axios.get(`${apiUrl.base}v1/ProjectTeam/detail/${id}`)
  },
  //项目部
  add(data) {
    return axios.post(`${apiUrl.base}v1/ProjectTeam/add`, data)
  },
  edit(data) {
    return axios.post(`${apiUrl.base}v1/ProjectTeam/edit`, data)
  },
  //工区
  workAdd(data) {
    return axios.post(`${apiUrl.base}v1/Workpoint/add`, data)
  },
  workEdit(data) {
    return axios.post(`${apiUrl.base}v1/Workpoint/edit`, data)
  },
  workDetail(id) {
    return axios.get(`${apiUrl.base}v1/Workpoint/detail/${id}`)
  },
  //部门
  depAdd(data) {
    return axios.post(`${apiUrl.base}v1/Dept/add`, data)
  },
  depEdit(data) {
    return axios.post(`${apiUrl.base}v1/Dept/edit`, data)
  },
  depDetail(id) {
    return axios.get(`${apiUrl.base}v1/Dept/detail/${id}`)
  },
  orgDelete(prames) {
    //项目部删除
    return axios.post(`${apiUrl.base}v1/ProjectTeam/delete`, prames)
  },
  workDelete(prames) {
    return axios.post(`${apiUrl.base}v1/Workpoint/delete`, prames)
  },
  depDelete(prames) {
    return axios.post(`${apiUrl.base}v1/Dept/delete`, prames)
  },
  // 项目列表
  projectGetAll(prames) {
    return axios.post(`${apiUrl.base}/v1/Project/selectAll`, prames)
  }
}
export default ProjectTeam
